const koa = require('koa')
const app = new koa()

/**
 * 整合 swagger
 * ==========start=============
 * */
const KoaSwagger = require('koa2-swagger-ui')
app.use(KoaSwagger({
  routePrefix: '/swagger',
  swaggerOptions: {
    url: 'swagger.json'
  }
}))
const swagger = require('./util/swagger')
app.use(swagger.routes(), swagger.allowedMethods())
/**
 *  ==========end=============
 * */

const router = require('./routes/index')

app.use(router.routes(), router.allowedMethods())
app.use(async ctx => {
  ctx.body = '哈哈哈'
})

app.listen(3000, () => {
  console.log('Server is running to 3000')
})